//
//  WZSignSettingCell.m
//  WZEfengAndEtong
//
//  Created by Hongpeng Yu on 2016/10/26.
//  Copyright © 2016年 wanzhao. All rights reserved.
//

#import "WZSignSettingCell.h"

@implementation WZSignSettingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+ (instancetype)signCellWithTableView:(UITableView *)tableView {
    
    static NSString *identifier = @"signSetting_Cell";
    WZSignSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[WZSignSettingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    return cell;
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.height = 55;
        [self setUpSubViewControls];
    }
    return self;
}


- (void)setUpSubViewControls {
    
    UILabel *nameLabel = [[UILabel alloc] init];
    
    nameLabel.numberOfLines = 0;
    [self.contentView addSubview:nameLabel];
    self.nameLabel = nameLabel;
    nameLabel.textAlignment = NSTextAlignmentLeft;
    nameLabel.font = [UIFont systemFontOfSize:15];
    nameLabel.textColor = [UIColor blackColor];
    
    UIImageView *stateImgView = [[UIImageView alloc] init];
    [self.contentView addSubview:stateImgView];
    self.stateImgView = stateImgView;
    
    UILabel *stateLabel = [[UILabel alloc] init];
    [self.contentView addSubview:stateLabel];
    self.stateLabel = stateLabel;
    stateLabel.textAlignment = NSTextAlignmentRight;
    stateLabel.font = [UIFont systemFontOfSize:15];
    stateLabel.textColor = RGBCOLORWITH16COLOR(0x999999);
    
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).mas_offset(15);
        make.centerY.equalTo(self.contentView);
    }];

    [stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView);
        make.centerY.equalTo(self.contentView);
    }];
    
    [stateImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(stateLabel.mas_left).mas_offset(-5);
        make.centerY.equalTo(self.contentView);
        make.width.height.mas_equalTo(20);
    }];
}

@end
